import time
from playwright.sync_api import sync_playwright
def test_mall():
    print('开始')
    with sync_playwright() as p:
        brow=p.chromium.launch(channel='msedge',headless=False)
        page=brow.new_page()
        page.goto('http://10.59.9.12:7001/home/login.html')
        time.sleep(2)
        page.fill('input[name="username"]','15649920322')
        time.sleep(2)
        page.fill('input[name="password"]','123456')
        time.sleep(10)
        page.click('xpath=//*[@id="theForm"]/div[5]/a')
        time.sleep(2)
        page.click('xpath=/html/body/div[3]/div[2]/ul/li[1]/a')
        time.sleep(5)
        page.fill('xpath=//*[@id="searchForm"]/div[1]/input','音乐耳机')
        time.sleep(2)
        page.click('xpath=//*[@id="searchForm"]/div[2]/input')
        time.sleep(5)
        page.click('xpath=/html/body/div[5]/div[2]/div[2]/div[1]/ul/li/div[1]/span/a/img')
        time.sleep(3)
        page.click('xpath=//*[@id="buy-cart"]')
        time.sleep(3)
        page.click('xpath=//*[@id="order-button"]')
        time.sleep(5)